﻿<Window x:Class="ViewModelExamples.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ViewModelExamples" Title="MainWindow" Height="802" Width="533">
    <StackPanel>
        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding AutomaticCommandViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Automatic Command Plumbing" Margin="5" />
                <Button Content="Execute MyCommand" Command="{Binding MyCommand}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding PropertyHelpersViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Property Helpers" Margin="5" />
                <TextBox Text="{Binding Text}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding DynamicPropertyViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Dynamic Properties" Margin="5" />
                <TextBlock Text="{Binding Foo}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding DefaultValuesViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Default Values" Margin="5" />
                <TextBox Text="{Binding Text}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding DependantPropertiesViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Dependant Property Chains" Margin="5" />
                <TextBox Text="{Binding Score}" Margin="5" />
                <TextBlock Text="{Binding Percentage}" Margin="5" />
                <TextBlock Text="{Binding Output}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding DependantMethodsViewModel, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Dependant Method Execution" Margin="5" />
                <TextBox Text="{Binding Score}" Margin="5" />
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding CanExecuteViewModel, Source={StaticResource ViewModelLocator}}" d:DataContext="{d:DesignInstance Type=local:CanExecuteViewModel, IsDesignTimeCreatable=True}" Margin="5">
            <StackPanel>
                <TextBlock Text="CanExecute Change Notification" Margin="5" />
                <StackPanel Orientation="Horizontal">
                    <Button Margin="5" Content="Make Lowercase" Command="{Binding MakeLower}" />
                    <TextBox Text="{Binding Input, UpdateSourceTrigger=PropertyChanged}" Margin="5" Width="50" />
                    <TextBlock Text="{Binding Output}" Margin="5" />
                </StackPanel>
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding DynamicPropertyBinding, Source={StaticResource MEFViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="Dynamic Property Binding" Margin="5" />
                <StackPanel>
                    <TextBox Text="{Binding Friend, UpdateSourceTrigger=PropertyChanged}" Margin="5" Width="50" />
                    <TextBlock Text="{Binding FriendSentance}" Margin="5" />
                    <Button Command="{Binding UpdateFriend}" CommandParameter="Mike" Content="Change Friend To Mike" Margin="5" />
                </StackPanel>
            </StackPanel>
        </Border>

        <Border CornerRadius="5" BorderThickness="2" BorderBrush="Black" DataContext="{Binding ViewModelWithDependancy, Source={StaticResource ViewModelLocator}}" Margin="5">
            <StackPanel>
                <TextBlock Text="ViewModel with Dependancy" Margin="5" />
                <StackPanel Orientation="Horizontal" Margin="5">
                    <TextBlock Text="Random Number: " />
                    <TextBlock Text="{Binding Value}" />
                </StackPanel>
            </StackPanel>
        </Border>

    </StackPanel>
</Window>
